package com.ruoyi.hcmain.controller;

import java.util.List;
import javax.servlet.http.HttpServletResponse;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.hcmain.domain.HcOutinfo;
import com.ruoyi.hcmain.service.IHcOutinfoService;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.common.core.page.TableDataInfo;

/**
 * 出库信息管理Controller
 * 
 * @author kylin
 * @date 2023-08-13
 */
@RestController
@RequestMapping("/hcmain/outinfo")
public class HcOutinfoController extends BaseController
{
    @Autowired
    private IHcOutinfoService hcOutinfoService;

    /**
     * 查询出库信息管理列表
     */
    @PreAuthorize("@ss.hasPermi('hcmain:outinfo:list')")
    @GetMapping("/list")
    public TableDataInfo list(HcOutinfo hcOutinfo)
    {
        startPage();
        List<HcOutinfo> list = hcOutinfoService.selectHcOutinfoList(hcOutinfo);
        return getDataTable(list);
    }

    /**
     * 导出出库信息管理列表
     */
    @PreAuthorize("@ss.hasPermi('hcmain:outinfo:export')")
    @Log(title = "出库信息管理", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response, HcOutinfo hcOutinfo)
    {
        List<HcOutinfo> list = hcOutinfoService.selectHcOutinfoList(hcOutinfo);
        ExcelUtil<HcOutinfo> util = new ExcelUtil<HcOutinfo>(HcOutinfo.class);
        util.exportExcel(response, list, "出库信息管理数据");
    }

    /**
     * 获取出库信息管理详细信息
     */
    @PreAuthorize("@ss.hasPermi('hcmain:outinfo:query')")
    @GetMapping(value = "/{outinfoId}")
    public AjaxResult getInfo(@PathVariable("outinfoId") Long outinfoId)
    {
        return success(hcOutinfoService.selectHcOutinfoByOutinfoId(outinfoId));
    }

    /**
     * 新增出库信息管理
     */
    @PreAuthorize("@ss.hasPermi('hcmain:outinfo:add')")
    @Log(title = "出库信息管理", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody HcOutinfo hcOutinfo)
    {
        return toAjax(hcOutinfoService.insertHcOutinfo(hcOutinfo));
    }

    /**
     * 修改出库信息管理
     */
    @PreAuthorize("@ss.hasPermi('hcmain:outinfo:edit')")
    @Log(title = "出库信息管理", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody HcOutinfo hcOutinfo)
    {
        return toAjax(hcOutinfoService.updateHcOutinfo(hcOutinfo));
    }

    /**
     * 删除出库信息管理
     */
    @PreAuthorize("@ss.hasPermi('hcmain:outinfo:remove')")
    @Log(title = "出库信息管理", businessType = BusinessType.DELETE)
	@DeleteMapping("/{outinfoIds}")
    public AjaxResult remove(@PathVariable Long[] outinfoIds)
    {
        return toAjax(hcOutinfoService.deleteHcOutinfoByOutinfoIds(outinfoIds));
    }
}
